<template>
	<view class="my-house">
		<view  @click="passMsg(v)" hover-class="navigator-hover" v-for="v in itemsData"
			:key="v.id">
			<view class="house-item">
				<view class="item-title">
					<view class="title-left">
						{{v.community}}
					</view>
					<view class="success" v-if="v.state=='审核通过'">审核通过</view>
					<view class="Certification" v-if="v.state=='审核中'">审核中</view>
					<view class="failed" v-if="v.state=='审核失败'">审核失败</view>
				</view>
				<view class="item-content">
					<view class="content-left">
						<text>房间号</text>
						<text>业主</text>
						<text>房屋状态</text>
					</view>
					<view class="content-right">
						<text>{{v.room}}</text>
						<text>{{v.name}}</text>
						<text>{{v.houseState}}</text>
					</view>
				</view>
			</view>
		</view>
		<navigator url="../myHouse/addHouse/addHouse" hover-class="navigator-hover">
			<view class="addhouse">
				+ 添加房屋
			</view>
		</navigator>
	</view>
</template>

<script>
	import {
		http
	} from "../../utils/http.js"
	export default {
		data() {
			return {
				itemsData: []
			};
		},
		methods: {
			getdata() {
				http({
					url: "/householdManagement/list",
					method: "get"
				}).then(({data}) => {
					this.itemsData=data.list
				})
			},
			passMsg(e){
				console.log(e,"12121212121212121212")
				uni.navigateTo({
					url: '../myHouse/propertyDetails/propertyDetails?dotMsg='+JSON.stringify(e)
				});
			}
		},
		onLoad(){
			this.getdata()
		}
	}
</script>

<style lang="less">
	.publictip() {
		font-size: 24rpx;
		padding: 10rpx 14rpx;
		border-radius: 4px;
	}

	.my-house {

		padding: 40rpx;
		height: 100%;

		.house-item {
			padding: 26rpx;
			display: flex;
			flex-direction: column;
			border-radius: 8rpx;
			box-shadow: 0px 0px 15rpx rgba(0, 0, 0, .2);
		
margin-bottom:100rpx ;
			.item-title {
				display: flex;
				align-items: center;
				justify-content: space-between;
				border-bottom: 1px solid #ccc;
				padding-bottom: 28rpx;

				.title-left {
					font-size: 32rpx;
				}

				.success {
					.publictip();
					color: #66ca94;
					background-color: #ddf3e6;

				}
			}

			.item-content {
				padding-top: 28rpx;
				display: flex;
				align-items: flex-start;

				.content-left,
				.content-right {
					display: flex;
					flex-direction: column;

					text {
						font-size: 28rpx;
						color: #aeaeae;
						margin-bottom: 22rpx;
					}

					text:last-child {
						margin-bottom: 0rpx;
					}

				}

				.content-right {
					margin-left: 26rpx;

					text {
						color: #000;
					}
				}
			}
		}

		.addhouse {
			width: 670rpx;
			height: 82rpx;
			text-align: center;
			line-height: 82rpx;
			background-color: #006fff;
			color: white;
			font-size: 34rpx;
			border-radius: 10rpx;
			position: fixed;
			left: 38rpx;
			bottom: 30rpx;
		}

	}

	.success {
		.publictip();
		color: #66ca94;
		background-color: #ddf3e6;
	}

	.Certification {
		.publictip();
		color: #e59657;
		background-color: #feeedf;
	}

	.failed {
		.publictip();
		color: #f57086;
		background-color: #fde1de;
	}
</style>
